const {
	http
} = uni.$u
// api白名单，名单中接口无需token
const apiWhiteList = [
	'/api/member/login',
	'/api/mobile/verify',
	'/wxapp/auth'
]
// 判断某接口url是否不需要带token(是否在白名单中)
export const isTokenNeedless = url => apiWhiteList.some(item => url.indexOf(item) !== -1)
/////////////////////////用户相关///////////////////////////
// 用户登录
export const login = params => http.post(`/api/mobile/login`, params)
// 用户登出
export const logout = () => http.delete(`/api/logout`)
// 获取用户信息
export const getUserInfo = params => http.get(`/api/getMobileUserInfo`, {
	params
})
// 获取验证码接口
export const getMobileVerifyCode = phoneNum => http.get(`/api/mobile/verify/${phoneNum}`)
// 微信登录
export const wxappAuth = params => http.post(`/api/wxapp/auth`, params)


/////////////////////////////公共/////////////////////////////
// 公告列表
export const getAnnouncementList = params => http.get(`/api/index/announcement/list`, {
	params
})
// 公告详情
export const getAnnouncementDetail = id => http.get(`/api/index/announcement/getById/${id}`)
// 首页轮播图
export const getIndexSwiper = params => http.get(`/api/index/slideshow/list`, {
	params
})

// 选择大区接口
export const getDepts = params => http.get(`/api/index/getDepts`, {
	params
})
// 获取经销商类型接口
export const dealerTypeDropList = params => http.get(`/api/index/dealerTypeDropList`, {
	params
})
// 省市区接口
export const cityList = params => http.get(`/api/index/cityList`, {
	params
})
// 终端标签
export const terminalLabel = params => http.get(`/api/index/terminalLabel`, {
	params
})
// 终端渠道
export const terminalChannels = params => http.get(`/api/index/terminalChannels`, {
	params
})
// 查询资金变动记录
export const getIntegralList = params => http.get(`/api/wallet/select/record`, {
	params
})
// 提现申请
export const withdrawDeposit = params => http.post(`/api/extract/cash`, params)
// 提现记录
export const withdrawDepositRecords = params => http.get(`/api/extract/list`, {
	params
})

// 收货地址相关---------------------
// 收货地址集合接口
export const getAddressList = params => http.get(`/api/lytUserAddress/address/list`, {
	params
})
// 设置默认地址接口
export const SetDefaultAddress = params => http.post(`/api/lytUserAddress/address/default/set`, params)
// 新增收货地址接口
export const addAddress = params => http.post(`/api/lytUserAddress/address/edit`, params)
// 修改收货地址接口
// todo
// 删除收货地址
export const deleteAddress = params => http.post(`/api/lytUserAddress/address/del`, params)
// 获取默认地址接口
export const getDefaultAddress = params => http.get(`/api/lytUserAddress/address/default`, {
	params
})
// 获取收货地址编辑信息接口
export const getAddressDetail = id => http.get(`/api/lytUserAddress/address/detail/${id}`)
// 省市区接口
export const getCity = params => http.get(`/api/index/cityList`, {
	params
})

// //////////////////经销商///////////////////////
// 经销商扫码
export const scanDealer = params => http.post(`/api/scan/dealer`, params)
// 进货统计
export const getGoodsStatistics = params => http.get(`/api/index/dealerEnterGoodsStatistics`, {
	params
})
// 终端进货统计
export const getzhongStatistics = params => http.get(`/api/index/terEnterGoodsStatistics`, {
	params
})
// 稽查接口
// todo
// 扫码收货接口
// todo
// 获取商品分类
export const getCategoryList = params => http.get(`/api/getCategoryList`, {
	params
})
// 获取商品列表
export const getLytProductDropList = params => http.get(`/api/getLytProductDropList`, {
	params
})
// 商品新增数量
export const getProductPrice = params => http.post(`/api/getProductPrice`, params)
// 创建订单
export const createOrder = params => http.post(`/api/order/create`, params)
// 订货列表
export const getOrderList = params => http.get(`/api/order/orderList`, {
	params
})
//查询扫码记录
export const getDealerScanRecord = params => http.get(`/api/scan/select/record`, {
	params
})
//订单详情
export const getOrderDetail = id => http.get(`/api/order/dtl/${id}`)
// 取消订单
export const cancelOrder = params => http.post(`/api/order/cancelOrder`, params)
// 修改订单
export const editOrder = params => http.post(`/api/order/editOrder`, params)
// 业务员审核通过（业务员）
export const saleStaffAuditPass = params => http.post(`/api/order/saleStaffAuditPass`, params)
// 业务员审核不通过业务员）
export const saleStaffAuditNoPass = params => http.post(`/api/order/saleStaffAuditNoPass`, params)
//我的专属业务员列表
export const getStaff = () => http.get(`/api/index/getStaff`)
// 后勤人员审核通过（后勤人员）
export const marketDeptAuditPass = params => http.post(`/api/order/marketDeptAuditPass`, params)
// 后勤人员审核不通过（后勤人员）
export const marketDeptAuditNoPass = params => http.post(`/api//order/marketDeptAuditNoPass`, params)
// 经销商上传图片
export const uploadImg = params => http.post(`/api/index/upload`, params)
// 经销商签收
export const signFor = params => http.post(`/api/order/signFor`, params)
// 经销商下单业务员列表
export const selectSaleStaffByDealer = params => http.get(`/api/index/selectSaleStaffByDealer`, {
	params
})
// 订货单选择默认业务员
export const orderSelectSaleStaff = params => http.post(`/api/index/orderSelectSaleStaff`, params)
// //////////////////终端店///////////////////////
// 终端扫码
export const scanTerminal = params => http.post(`/api/scan/terminal`, params)
// 稽查接口
export const getSelectAuditing = params => http.get(`/api/scan/selectAuditing`, {
	params
})
// 终端进货明细接口
// todo

// //////////////////业务员///////////////////////
// 业务员数据概览接口
export const getHomeNums = params => http.get(`/api/index/showData`, {
	params
})
// 进货明细  （进货统计）
export const channelEnterGoodsStatistics = params => http.get(`/api/index/channelEnterGoodsStatistics`, {
	params
})
// 宴会产品扫码接口
// todo
// 终端查询接口
export const getTerminalList = params => http.get(`/api/index/terminalList`, {
	params
})
// 终端列表接口
export const getTerminalList2 = params => http.get(`/api/index/terList`, {
	params
})
// 修改终端信息接口
export const editTer = params => http.post(`/api/index/editTer`, params)
// 新增终端
export const addTer = params => http.post(`/api/index/addTer`, params)
// 终端详情
export const getTerDtl = id => http.get(`/api/index/terDtl/${id}`)
// 终端停用接口
export const disableTer = params => http.post(`/api/index/disableTer`, params)

// 经销商查询接口
export const getDealerList = params => http.get(`/api/index/dealerList`, {
	params
})
// 一级经销商列表
export const secondDealerListOne = params => http.get(`/api/index/firstDealerList`, {
	params
})
// 二级经销商列表
export const secondDealerList = params => http.get(`/api/index/secondDealerList`, {
	params
})
// 二级经销商停用
export const disableSecond = params => http.post(`/api/index/disableSecond`, params)
// 二级经销商新增
export const addSecond = params => http.post(`/api/index/addSecond`, params)
// 修改二级经销
export const editSecond = params => http.post(`/api/index/editSecond`, params)
// 二级经销商详情
export const secondDtl = id => http.get(`/api/index/secondDtl/${id}`)

// 服务员列表接口
export const waiterList = params => http.get(`/api/index/waiterList`, {
	params
})
// 服务员停用接口
export const disableWaiter = params => http.post(`/api/index/disableWaiter`, params)
// 服务员详情接口
export const getWaiterDetail = id => http.get(`/api/index/waiterDtl/${id}`)
// 修改服务员信息接口
export const editWaiter = params => http.post(`/api/index/editWaiter`, params)
// 新增服务员
export const addWaiter = params => http.post(`/api/index/addWaiter`, params)

// 业务员列表
export const selectSaleStaff = params => http.get(`/api/index/selectSaleStaff`, {
	params
})
// 添加业务员接口
export const addSaleStaff = params => http.post(`/api/index/addSaleStaff`, params)
// 停用业务员
export const disableSaleStaff = params => http.post(`/api/index/disableSaleStaff`, params)
// 业务员详情接口
export const saleStaffDetail = id => http.get(`/api/index/saleStaffDtl/${id}`)
// 修改业务员信息接口
export const editSaleStaff = params => http.post(`/api/index/editSaleStaff`, params)
//品鉴会新增修改接口
export const tastingCu = params => http.post(`/api/tasting/createOrUpdate`, params)
//品鉴会列表
export const tastingList = params => http.get(`/api/tasting/list`, {
	params
})
//品鉴会详情接口
export const tastingDetail = id => http.get(`/api/tasting/${id}`)
//扫码核销接口
export const tastScan = params => http.post(`/api/tasting/tastScan`, params)
//品鉴会扫码核销记录
export const getTastingRecord = params => http.get(`/api/tasting/getTastingRecord`, {
	params
})
//代替扫码-扫码提示页面
export const replaceScanCheck = params => http.post(`/api/scan/replaceScanCheck`, params)
//代替扫码-扫码确认
export const replaceScan = params => http.post(`/api/scan/replaceScan`, params)

// //////////////////服务员///////////////////////
// 数据概览接口
// todo
// 服务员扫码兑奖
export const scanWaiter = params => http.post(`/api/scan/waiter`, params)
